# dj.utils.xml

## Summary
This module provides a collection of utility functions for handling XML. It is based on the [xmldom-es](https://github.com/code4fukui/xmldom-es) library, which is a fork of [xmldom](https://github.com/xmldom/xmldom).
The primary feature of this module is its ability to parse XML strings into JSON objects and convert JSON objects back into XML strings.

## Files
* converntions.js
* dom-parser.js
* dom.js
* entities.js
* index.js
* sax.js
* xml.js
* xmldom.js

## Dependencies
None

## Sample
``` javascript
import { XML } from '../modules/dj/utils/xml/xml.js';
let data = `<?xml version="1.0" encoding="utf-8"?> 
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
        <soap:Body> 
            <NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/"> 
            <ubiNum>123</ubiNum> 
            </NumberToWords> 
        </soap:Body> 
    </soap:Envelope>`;
    
//Convert XML string to JSON object
/** 
{
	"soap:Envelope": {
		"xmlns:soap": "http://schemas.xmlsoap.org/soap/envelope/",
		"soap:Body": {
			"NumberToWords": {
				"xmlns": "http://www.dataaccess.com/webservicesserver/",
				"ubiNum": {
					"#text": "123"
				}
			}
		}
	}
}
*/
const json = XML.toJSON(data);
logger.info(json)

//Convert JSON object back to XML string
/**
 * <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
      <ubiNum>
        123
      </ubiNum>
    </NumberToWords>
  </soap:Body>
</soap:Envelope>
 */
const xml = XML.stringify(json)
logger.info(xml)
```